#include <stdlib.h>
#include <stdio.h>
#define MAX_CONNECTIONS 32

struct node;
struct connection;

struct node
{
	/* We need to define how much fast we can ul/dl.
	 * These floats represent B/sec. */
	float upload_limit;
	float download_limit;

	// The size of total data recieved so far.
	int sum_recv;
	
	// The array of pointers to connections according to our topology.
	struct connection** links;
	
	// My ID in the network
	int ID;
};

struct connection
{
	// What two nodes are connected?
	struct node *alpha;
	struct node *beta;

	/* What is the maximum velocity at which this
	 * connection should transfer data?  If the data is
	 * transferring from alpha -> beta, this number should
	 * be non-negative. */
	float velocity;
};

struct node** neighbors (struct node *n)
{
	int i;
	struct node** array;
	array = malloc(sizeof(struct node) * MAX_CONNECTIONS);

	for (i=0; i<MAX_CONNECTIONS; i++) {
		array[i] = n->links[i]->alpha->ID == n->ID ? n->links[i]->beta : n->links[i]->alpha;
	}
	return array;
}
